package com.cqjtu.tto.controller;

import cn.dev33.satoken.annotation.SaCheckRole;
import com.cqjtu.tto.service.DepartmentService;
import com.cqjtu.tto.service.RoleService;
import com.cqjtu.tto.vo.Results;
import com.cqjtu.tto.vo.params.DepartmentParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author：monkey-L
 * @description:
 * @date: 17:15 2021/12/11
 */
@RestController
@Api(tags = "角色模块")
public class RoleController {

    @Autowired
    private RoleService roleService;

//    @SaCheckRole("admin")
    @PostMapping("roleAdd")
    @ApiOperation(value = "增加角色")
    public Results roleAdd(String roleName) {
        return roleService.roleAdd(roleName);
    }

//    @SaCheckRole("admin")
    @PostMapping("roleDelete")
    @ApiOperation(value = "删除角色",notes = "根据角色名字删除角色")
    public Results roleDelete(String roleName) {
        return roleService.roleDelete(roleName);
    }

//    @SaCheckRole("admin")
    @PostMapping("roleUpdate")
    @ApiOperation(value = "更新角色")
    public Results roleUpdate(String oldRoleName, String newRoleName) {
        return roleService.roleUpdate(oldRoleName, newRoleName);
    }

//    @SaCheckRole("admin")
    @PostMapping("roleSelectOne")
    @ApiOperation(value = "查询角色",notes = "根据角色名字查询")
    public Results roleSelectOne(String roleName) {
        return roleService.roleSelectOne(roleName);
    }

//    @SaCheckRole("admin")
    @ApiOperation(value = "查询所有角色")
    @PostMapping("roleSelectList")
    public Results roleSelectList() {
        return roleService.roleSelectList();
    }
}
